Skip to content

Added possibility to combine index and filename args#426

Closed
aaltat wants to merge 15 commits into
robotframework:masterfrom
aaltat:master
Closed

Added possibility to combine index and filename args#426
aaltat wants to merge 15 commits into
robotframework:masterfrom
aaltat:master

Conversation

@aaltat

@aaltat aaltat commented Jun 7, 2015

Copy link
Copy Markdown
Contributor

If test are run, to get a custom and unique file name each time screenshot is takes, it would require creating global variable in RF data and making sure that variable in unique for each time screenshot is taken. This is now much easier to do with the index param in the Capture Page Screenshot keyword.

This comes quite handy when you using pabot and want to make sure that screenshots do not overlap in names.

If test are run, to get a custom and unique filename
each time screenshot is takes, it would require
creating blobal variable in RF data and making
sure that variable in unique for each time
screenshot is taken. This is now much easier
to do with the index param in the Capture
Page Screenshot keyword.
@aaltat

aaltat commented Jun 7, 2015

Copy link
Copy Markdown
Contributor Author

And did forget to say that removed the css from keyword documentation because it was not actually defined or used anywhere.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

paraler -> parallel

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed the typo

@just-be-dev

Copy link
Copy Markdown
Contributor

This should probably be the default behavior.

@pekkaklarck, @ombre42 If we take a screen shot and specify the file to save it to but that file already exists, should we append a -1 to it by default? Or rather, is there any cause where we wouldn't want that behavior to occur?

@aaltat

aaltat commented Jun 7, 2015

Copy link
Copy Markdown
Contributor Author

@zephraph Perhaps if you use Wait Until Keyword Succeeds? But that is quite a long shot, in my mind.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change index here to overwrite and default it to False.

@just-be-dev

Copy link
Copy Markdown
Contributor

@aaltat, I've made suggestions on how I think it should be.

I'd like it to always append the index unless it's specified not to. Also, Instead of having the argument index, I'd rather it be overwrite (so it more clearly reflects what it does).

@pekkaklarck

Copy link
Copy Markdown
Member

I'd say that, in general, if you give an exact file and that file exist, it should be overwritten. Not certain about this particular case, though. Having an option to control the behavior is obviously the most generic solution.

@just-be-dev

Copy link
Copy Markdown
Contributor

I suppose the default doesn't really matter to me so long as its well documented.

@pekkaklarck

Copy link
Copy Markdown
Member

FWIW, `overwrite=False' sounds good to me as the default. I don't feel too strongly about this either way.

@aaltat

aaltat commented Jun 8, 2015

Copy link
Copy Markdown
Contributor Author

I feel also that false is better, I will try to do changes today or tomorrow.

Now if the filename exist, new one is created by adding
counter in the end (but before .png). All the existing
acceptance tests do pass and where not modified. New ones
where modified to meet the new requirements.
@aaltat

aaltat commented Jun 9, 2015

Copy link
Copy Markdown
Contributor Author

Changed code to more clearly to do what @zephraph expressed in the keyword documentation comment.

And now there is a global and common counter for all files and I also do not like it.

But I was thinking that could be separate pull request and perhaps add more formatting to the counter? Not like 1,2,3 but like 001, 002 and so on.

@aaltat

aaltat commented Jun 9, 2015

Copy link
Copy Markdown
Contributor Author

And now the acceptance test are, for this new feature, in one blob/test which is not good. Should I refactor that be more clear?

@just-be-dev

Copy link
Copy Markdown
Contributor

I'm still not 100% satisfied with this, but you're definitely on the right track. I'm going to submit a PR to your branch with what I had in mind.

Now for each filename, there is unique index saved in a dictionary.
This makes the end result, the screenshots, more easier to
read and maintain.
@aaltat

aaltat commented Jun 10, 2015

Copy link
Copy Markdown
Contributor Author

Refactored the code to contain unique index for each file name. Also changed to acceptance test be more readable.

Is this OK?

| Open Browser | www.someurl.com | browser=${BROWSER} |
| Screen Capture | overwrite=${True} | # overwrite is ignored |
| Screen Capture | overwrite=${True} | # overwrite is ignored |
| File Should Exist  | ${OUTPUTDIR}${/}selenium-screenshot-1.png |
| File Should Exist  | ${OUTPUTDIR}${/}selenium-screenshot-2.png |

This is how to code now works.

@just-be-dev

Copy link
Copy Markdown
Contributor

I'll review this after work today.

At first glance though it looks pretty good.

@aaltat

aaltat commented Jun 12, 2015

Copy link
Copy Markdown
Contributor Author

Noticed that I did forget to update the keyword documentation. I am busy for next few days, but I will do it next week.

@just-be-dev

Copy link
Copy Markdown
Contributor

That's fine, the next minor release won't be until at least the end of next week.

@aaltat

aaltat commented Jun 15, 2015

Copy link
Copy Markdown
Contributor Author

The keyword documentation is now fixed, at least for my eyes. Comments?

@just-be-dev

Copy link
Copy Markdown
Contributor

This looks pretty good. It's varies a little from my original intent, but I think it's ample for this problem. Give me a little while to review it. If I don't find anything I'll merge it in later this afternoon.

Thanks for all your hard work @aaltat.

@aaltat

aaltat commented Jul 24, 2015

Copy link
Copy Markdown
Contributor Author

How does it looks and should I do something because master has moved forward?

@just-be-dev

Copy link
Copy Markdown
Contributor

Oh yeah, this'll be interesting... I've done a bit of work on screenshots recently so there will be a bit to merge.

@aaltat

aaltat commented Jul 24, 2015

Copy link
Copy Markdown
Contributor Author

I squashed all my commits to a single commit and fixed all the conflicts with master. Now all acceptance test are passing (in windows and Firefox), but because because of some git magic, this can be found from #465. Should I close this pull request and should we continue on the #465?

@just-be-dev

Copy link
Copy Markdown
Contributor

Yeah, let's just close this in favor of #465

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants